from flask import Flask
from flask_cors import CORS
from route import slave,log,machine,monitor

def create_app():
    app = Flask(__name__)
    # 允许跨域访问
    CORS(app)
    # 注册子路由
    app.register_blueprint(slave.slave, url_prefix='/slave')
    app.register_blueprint(machine.machine, url_prefix='/machine')
    app.register_blueprint(monitor.monitor, url_prefix='/monitor')
    app.register_blueprint(log.log, url_prefix='/log')
    return app


app = create_app()

@app.route('/')
def test():
    print("成功") 

if __name__=="__main__":
    app.run(host='0.0.0.0',port=45575)
